<template>
	<div id="app" class="navMenu">
		<!-- <nav>
			<router-link to="/user">用户管理</router-link>

			<router-link to="/about">预约项目</router-link>
			<router-link to="/shop">店铺管理</router-link>
			<router-link to="/log">日志管理</router-link>
			<router-link to="/about">关于</router-link>
		</nav> -->
		<el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect" router>
			<el-menu-item index="1" route="/user">用户列表</el-menu-item>
			<el-menu-item index="2" route="/product">可预约商品</el-menu-item>
			<el-menu-item index="3" route="/shop">门店列表</el-menu-item>
			<el-menu-item index="4" route="/log">日志列表</el-menu-item>
			<el-menu-item index="5" route="/about">关于</el-menu-item>
		</el-menu>

		<router-view />
	</div>
</template>
<script>
export default {
	data() {
		return {
			activeIndex: localStorage.getItem('activeIndex') == null ? '1' : localStorage.getItem('activeIndex'),
		};
	},
	created() {
		// console.log(this.$router.path);
		// if (this.$router.go == '/' || this.$router.path == undefined) {
		// 	this.activeIndex = '4';
		// 	localStorage.setItem('activeIndex', '4');
		// }
		console.log(this.activeIndex);
	},
	methods: {
		handleSelect(key) {
			//, keyPath
			// console.log(key, keyPath);
			// this.activeIndex = key;
			localStorage.setItem('activeIndex', key);
		},
	},
};
</script>
<style>
#app {
	font-family: Avenir, Helvetica, Arial, sans-serif;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-align: center;
	color: #2c3e50;
}

nav {
	padding: 30px;
}

nav a {
	font-weight: bold;
	color: #2c3e50;
}

nav a.router-link-exact-active {
	color: #42b983;
}
</style>
